using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;


namespace DataHelper.BLL
{
    public class webpages_UsersInRoles
    {
        public int UserId { get; set; }
        public int RoleId { get; set; }

        #region webpages_UsersInRolesSelectAll
        public static List<webpages_UsersInRoles> webpages_UsersInRolesSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.webpages_UsersInRoles.webpages_UsersInRolesSelectAll(strSearch,top,bottom,ConnectionString);
            List<webpages_UsersInRoles> webpages_UsersInRolesList = new List<webpages_UsersInRoles>();
            while(dr.Read())
            {
                webpages_UsersInRoles mywebpages_UsersInRoles = new webpages_UsersInRoles
                {
                    UserId = !dr.IsDBNull(dr.GetOrdinal("UserId")) ? (int)dr["UserId"] : 0,
                    RoleId = !dr.IsDBNull(dr.GetOrdinal("RoleId")) ? (int)dr["RoleId"] : 0
                };
                webpages_UsersInRolesList.Add(mywebpages_UsersInRoles);
        }
        dr.Close();
        dr.Dispose();
        return webpages_UsersInRolesList;
        }
        #endregion
        #region webpages_UsersInRolesSelectRow
        public static webpages_UsersInRoles webpages_UsersInRolesSelectRow(int UserId, int RoleId, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.webpages_UsersInRoles.webpages_UsersInRolesSelectRow(UserId, RoleId, ConnectionString);
            webpages_UsersInRoles webpages_usersinroles = null;

            if(dr.Read())
            {
                webpages_usersinroles= new webpages_UsersInRoles
                {
                    UserId = !dr.IsDBNull(dr.GetOrdinal("UserId")) ? (int)dr["UserId"] : 0,
                    RoleId = !dr.IsDBNull(dr.GetOrdinal("RoleId")) ? (int)dr["RoleId"] : 0,

                };
            }
        dr.Close();
        dr.Dispose();
        return webpages_usersinroles;
        }
        #endregion

        #region webpages_UsersInRolesSelectRowByForeignKey_UserId
        public static List<webpages_UsersInRoles> webpages_UsersInRolesSelectRowByForeignKey_UserId(int UserId, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.webpages_UsersInRoles.webpages_UsersInRolesSelectRowByForeignKey_UserId(UserId,ConnectionString);
            List<webpages_UsersInRoles> webpages_UsersInRolesList = new List<webpages_UsersInRoles>();
            while(dr.Read())
            {
                webpages_UsersInRoles mywebpages_UsersInRoles = new webpages_UsersInRoles
                {
                    UserId = !dr.IsDBNull(dr.GetOrdinal("UserId")) ? (int)dr["UserId"] : 0,
                    RoleId = !dr.IsDBNull(dr.GetOrdinal("RoleId")) ? (int)dr["RoleId"] : 0
                };
                webpages_UsersInRolesList.Add(mywebpages_UsersInRoles);
        }
        dr.Close();
        dr.Dispose();
        return webpages_UsersInRolesList;
        }
        #endregion

        #region webpages_UsersInRolesSelectRowByForeignKey_RoleId
        public static List<webpages_UsersInRoles> webpages_UsersInRolesSelectRowByForeignKey_RoleId(int RoleId, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.webpages_UsersInRoles.webpages_UsersInRolesSelectRowByForeignKey_RoleId(RoleId,ConnectionString);
            List<webpages_UsersInRoles> webpages_UsersInRolesList = new List<webpages_UsersInRoles>();
            while(dr.Read())
            {
                webpages_UsersInRoles mywebpages_UsersInRoles = new webpages_UsersInRoles
                {
                    UserId = !dr.IsDBNull(dr.GetOrdinal("UserId")) ? (int)dr["UserId"] : 0,
                    RoleId = !dr.IsDBNull(dr.GetOrdinal("RoleId")) ? (int)dr["RoleId"] : 0
                };
                webpages_UsersInRolesList.Add(mywebpages_UsersInRoles);
        }
        dr.Close();
        dr.Dispose();
        return webpages_UsersInRolesList;
        }
        #endregion

        #region webpages_UsersInRolesSelectRowByForeignKey_UserId_RoleId
        public static List<webpages_UsersInRoles> webpages_UsersInRolesSelectRowByForeignKey_UserId_RoleId(int UserId,int Role, SqlTransaction ConnectionString = null)
        {
            IDataReader dr = DataHelper.DAL.webpages_UsersInRoles.webpages_UsersInRolesSelectRowByForeignKey_UserId_RoleId(UserId,Role, ConnectionString);
            List<webpages_UsersInRoles> webpages_UsersInRolesList = new List<webpages_UsersInRoles>();
            while(dr.Read())
            {
                webpages_UsersInRoles mywebpages_UsersInRoles = new webpages_UsersInRoles
                {
                    UserId = !dr.IsDBNull(dr.GetOrdinal("UserId")) ? (int)dr["UserId"] : 0,
                    RoleId = !dr.IsDBNull(dr.GetOrdinal("RoleId")) ? (int)dr["RoleId"] : 0
                };
                webpages_UsersInRolesList.Add(mywebpages_UsersInRoles);
        }
        dr.Close();
        dr.Dispose();
        return webpages_UsersInRolesList;
        }
        #endregion
        #region webpages_UsersInRolesInsertRow
        public static void webpages_UsersInRolesInsertRow(int UserId, int RoleId, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.webpages_UsersInRoles.webpages_UsersInRolesInsertRow(UserId, RoleId, ConnectionString);
        }
        #endregion
        #region webpages_UsersInRolesUpdateRow
        public static void webpages_UsersInRolesUpdateRow(int UserId, int RoleId, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.webpages_UsersInRoles.webpages_UsersInRolesUpdateRow(UserId, RoleId, ConnectionString);
        }
        #endregion
        #region webpages_UsersInRolesDeleteRow
        public static void webpages_UsersInRolesDeleteRow(int UserId, int RoleId, SqlTransaction ConnectionString = null)
        {
            DataHelper.DAL.webpages_UsersInRoles.webpages_UsersInRolesDeleteRow(UserId, RoleId,ConnectionString);
        }
        #endregion
    }
}
